package com.zhiyou.crud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhiyou.crud.bean.Employee;
import com.zhiyou.crud.bean.Msg;
import com.zhiyou.crud.service.EmployeeService;

@Controller
public class DepartmentController {

	@Autowired
	EmployeeService employeeservic;
	
	
	@RequestMapping("/qidong")

	public String aa(@RequestParam(value="pn",defaultValue="1")Integer pn,Model model) {
		System.out.println("启动项目成功");
		PageHelper.startPage(pn,5);
		List<Employee> list= employeeservic.getAll();
		System.out.println(list.size()+"list的长度");
		
		
		
		
		PageInfo page=new PageInfo(list,5);
		model.addAttribute("pageInfo",page);
		return "list";
	}
	
	
}
